package com.gexin.common.job;


import com.gexin.model.user.UserCoupon;
import com.jfinal.log.Log;

import java.util.List;

/**
 * 优惠券过期定时器
 */
public class CouponJob implements Runnable {
	static Log log = Log.getLog(OrderJob.class);

	public void run() {
		log.info("执行优惠券过期方法");
		List<UserCoupon> userCoupons = UserCoupon.dao.find("select * from t_user_coupon where ending_date<now() and use_state=0");
		for (UserCoupon userCoupon : userCoupons) {
			userCoupon.setUseState(UserCoupon.STATE_YIGUOQI);
			userCoupon.update();
		}
	}

}
